import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 自动回收配置信息 */
export interface Recycling {
  id: number // ID
  days?: number // 天数
  star: number // 星级
  status: number // 状态
}

// 自动回收配置 API
export const RecyclingApi = {
  // 查询自动回收配置分页
  getRecyclingPage: async (params: any) => {
    return await request.get({ url: `/system/recycling/page`, params })
  },

  // 查询自动回收配置详情
  getRecycling: async (id: number) => {
    return await request.get({ url: `/system/recycling/get?id=` + id })
  },

  // 新增自动回收配置
  createRecycling: async (data: Recycling) => {
    return await request.post({ url: `/system/recycling/create`, data })
  },

  // 修改自动回收配置
  updateRecycling: async (data: Recycling) => {
    return await request.put({ url: `/system/recycling/update`, data })
  },

  // 删除自动回收配置
  deleteRecycling: async (id: number) => {
    return await request.delete({ url: `/system/recycling/delete?id=${id}` })
  },

  /** 批量删除自动回收配置 */
  deleteRecyclingList: async (ids: number[]) => {
    return await request.delete({ url: `/system/recycling/delete-list?ids=${ids.join(',')}` })
  },

  // 导出自动回收配置 Excel
  exportRecycling: async (params) => {
    return await request.download({ url: `/system/recycling/export-excel`, params })
  }
}
